package behavioral.iterator;

public class IteratorTest {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		BookShelf bookShelf = new BookShelf(5);
		bookShelf.appendBook(new Book("Around the World in 80 Days"));
		bookShelf.appendBook(new Book("Bible"));
		bookShelf.appendBook(new Book("Cinderella"));
		bookShelf.appendBook(new Book("Daddy-Long-Legs"));
		Iterator it = bookShelf.createIterator();
		/*System.out.println(((Book)it.first()).getName());
		System.out.println(((Book)it.currentItem()).getName());
		while(!it.isDone()) {
			Book book = (Book) it.next();
			System.out.println(book.getName());
		}*/
		while(it.hasNext()) {
			Book book = (Book) it.next();
			System.out.println(book.getName());
		}
	}

}
